﻿<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__STATIC__/admin/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__STATIC__/admin/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/admin/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui.admin/css/page.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="__STATIC__/admin/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>文章列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 文章管理 <span
        class="c-gray en">&gt;</span> 文章列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                               href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="row cl mb-20">
        <div class="col-xs-6 text-l">
            <a href="javascript:;" onclick="articleAdd()" class="btn btn-primary radius">
                <i class="Hui-iconfont">&#xe600;</i> 添加文章</a>
        </div>
        <div class="col-xs-6 text-r">
            <form id="form1" action="{:url('article/index')}" method="get">
                <input type="text" class="input-text" style="width:250px" placeholder="输入文章名称" id="art_title" name="art_title" value="{$art_title}">
                <button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜文章</button>
            </form>
        </div>
    </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr class="text-c">
            <th width="30">ID</th>
            <th width="150">文章标题</th>
            <th width="30">文章内容</th>
            <th width="30">分类</th>
            <th width="100">发布时间</th>
            <th width="30">作者</th>
            <th width="30">置顶状态</th>
            <th width="30">状态</th>
            <th width="30">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            <td>{$vo.article_id}</td>
            <td>{$vo.art_title}</td>
            <td>
                <a href="javascript:;"  onclick="showContent({$vo.article_id})" class="ml-5"
                   style="text-decoration:none;color:blue">文章内容</a>
            </td>
            <td>{$vo.cate_name}</td>
            <td>{$vo.release_time}</td>
            <td>{$vo.author_user}</td>
            <td>
                {eq name="$vo.top" value="0"}<span style="color: green">已置顶</span>{/eq}
                {eq name="$vo.top" value="1"}<span style="color: blue">未置顶</span>{/eq}
            </td>
            <td>
                {eq name="$vo.state" value="1"}<span style="color: green">已发布</span>{/eq}
                {eq name="$vo.state" value="2"}<span style="color: blue">草稿</span>{/eq}
            </td>
            <td class="td-article">
                <a title="编辑" href="javascript:;" onclick="articleUpd({$vo.article_id})" class="ml-5"
                   style="text-decoration:none">
                    <i class="Hui-iconfont">&#xe6df;</i></a>
                <a title="删除" href="javascript:;" onclick="articleDel({$vo.article_id})" class="ml-5"
                   style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page text-l">{$page}</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__STATIC__/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__STATIC__/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    /*显示-内容*/
    function showContent(article_id) {
        var title = "文章内容";
        var url = "{:url('article/content')}?article_id="+article_id;
        var w = 800;
        var h = 600;
        layer_show(title, url, w, h);
    }
    /*文章-增加*/
    function articleAdd() {
        var title = "文章新增";
        var url = "{:url('article/add')}";
        var w = 1200;
        var h = 700;
        var index = layer.open({
            type: 2,
            area: [w+'px', h +'px'],
            fix: false, //不固定
            maxmin: true,
            shade:0.4,
            title: title,
            content: url
        });
        layer.full(index);
    }

    /*文章-导入*/
    function articleInput() {
        var title = "文章导入";
        var url = "{:url('article/input')}";
        var w = 800;
        var h = 600;
        var index = layer.open({
            type: 2,
            area: [w+'px', h +'px'],
            fix: false, //不固定
            maxmin: true,
            shade:0.4,
            title: title,
            content: url
        });
    }

    /*文章-编辑*/
    function articleUpd(article_id) {
        var title = "文章编辑";
        var url = "{:url('article/upd')}?article_id="+article_id;
        var w = 1200;
        var h = 700;
        var index = layer.open({
            type: 2,
            area: [w+'px', h +'px'],
            fix: false, //不固定
            maxmin: true,
            shade:0.4,
            title: title,
            content: url
        });
        layer.full(index);
    }

    /*文章-删除*/
    function articleDel(article_id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: 'POST',
                url: '{:url("article/del")}',
                data: {
                    article_id: article_id
                },
                dataType: 'json',
                success: function (res) {
                    if (res.code == 1) {
                        layer.alert(res.message);
                    }
                    if (res.code == 0) {
                        location.reload();//刷新
                    }
                },
                error: function () {
                    console.log("异常");
                }
            });
        });
    }
</script>
</body>
</html>